package Practice6_Internet.P2_TCP;

import Utils.io.IOUtils;
import Utils.web.TcpUtils;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;

public class PracticeTestNew {
    /**
     * 客户端
     */
    @Test
    public void client() throws IOException {
        InetAddress ia = InetAddress.getByName("192.168.56.1");
        try (Socket socket = new Socket(ia, 8899)) {
            TcpUtils.clientSendMessageToServer("你好，我是客户端",socket);
        }
    }

    /**
     * 服务端
     */
    @Test
    public void server() throws IOException {
            System.out.println(TcpUtils.serverAcceptMessageFromClient(8899));
    }

    @Test
    public void test01() throws IOException {
        IOUtils.copyLargeFile("D:\\个人文件\\审计相关\\前端取数方法.zip","D:\\个人文件\\计算机\\Java\\练习\\前端取数方法.zip");
    }
}
